<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateMessagesTalbe extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('messages',function($table){
			$table->engine = 'InnoDB';
			$table->increments('id');
			$table->integer('to_user_id');
			$table->integer('from_user_id');
			//消息类型，1为用户，2为系统
			$table->tinyInteger('message_type')->default(1);
			$table->text('message_content')->default('');
			$table->tinyInteger('is_read')->default(0);
			$table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('messages');
	}

}
